package com.example.ideaexithoot;

import javax.swing.*;
import java.awt.*;

public class AutoPushSettingsComponent {
    private JPanel mainPanel;
    private JTextField autopushPathField;

    public AutoPushSettingsComponent() {
        autopushPathField = new JTextField();
        autopushPathField.setColumns(30); // 设置合理宽度

        mainPanel = new JPanel(new BorderLayout(5, 5));
        JPanel inputPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
        inputPanel.add(new JLabel("AutoPush 脚本路径:"));
        inputPanel.add(autopushPathField);

        mainPanel.add(inputPanel, BorderLayout.NORTH);
    }

    public JPanel getPanel() {
        return mainPanel;
    }

    public JComponent getPreferredFocusedComponent() {
        return autopushPathField;
    }

    public String getAutopushPath() {
        return autopushPathField.getText();
    }

    public void setAutopushPath(String value) {
        autopushPathField.setText(value != null ? value : "");
    }
}